package com.haixue.android.academy.utils;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;

/**
 * Created by ren on 2015/5/22 0022.
 */
public class IntentUtils {
    public static final int DEFAULT_REQUEST_CODE = 0;
    public static final int DEFAULT_RESPONE_CODE = 1;

    public static void toActivityAfterFinish(Context context,Class<?> clazz) {
        Intent intent = new Intent(context, clazz);
        context.startActivity(intent);
        ((Activity)context).finish();
    }
    public static void toActivityAfterFinish(Context context,Intent intent) {
        context.startActivity(intent);
        ((Activity)context).finish();
    }

    public static void toActivity(Context context,Intent intent) {
        context.startActivity(intent);
    }
    public static void toActivityFoResult(Context context,Intent intent) {
        ((Activity)context).startActivityForResult(intent, DEFAULT_REQUEST_CODE);
    }
}
